From: Matthieu Gallien Date: Wed, 18 Dec 2024 11:04:47 +0000 (+0100) Subject: prevent crash by catching more exception types from c++ std lib X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~30^2^2~165^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1f32d1f9d758d0739a6e0d5c99f8e959a7e2255d;p=nextcloud-desktop.git prevent crash by catching more exception types from c++ std lib Signed-off-by: Matthieu Gallien --- diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 8371cc336..af9e19cb6 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -131,6 +131,14 @@ void FileSystem::setFileReadOnly(const QString &filename, bool readonly) { qCWarning(lcFileSystem()) << filename << (readonly ? "readonly" : "read write") << e.what(); } + catch (std::system_error e) + { + qCWarning(lcFileSystem()) << filename << e.what(); + } + catch (...) + { + qCWarning(lcFileSystem()) << filename; + } return; } #endif @@ -176,6 +184,14 @@ bool FileSystem::setFileReadOnlyWeak(const QString &filename, bool readonly) { qCWarning(lcFileSystem()) << filename << (readonly ? "readonly" : "read write") << e.what(); } + catch (std::system_error e) + { + qCWarning(lcFileSystem()) << filename << e.what(); + } + catch (...) + { + qCWarning(lcFileSystem()) << filename; + } return false; } #endif @@ -468,6 +484,14 @@ bool FileSystem::isWritable(const QString &filename, const QFileInfo &fileInfo) { qCWarning(lcFileSystem()) << filename << e.what(); } + catch (std::system_error e) + { + qCWarning(lcFileSystem()) << filename << e.what(); + } + catch (...) + { + qCWarning(lcFileSystem()) << filename; + } return false; } #endif @@ -494,6 +518,14 @@ bool FileSystem::isReadable(const QString &filename, const QFileInfo &fileInfo) { qCWarning(lcFileSystem()) << filename << e.what(); } + catch (std::system_error e) + { + qCWarning(lcFileSystem()) << filename << e.what(); + } + catch (...) + { + qCWarning(lcFileSystem()) << filename; + } return false; } #endif diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index d47061c9c..3bcfd2373 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -1223,6 +1223,14 @@ void PropagateDownloadFile::downloadFinished() { qCWarning(lcPropagateDownload()) << _item->_instruction << _item->_file << e.what(); } + catch (std::system_error e) + { + qCWarning(lcPropagateDownload()) << _item->_instruction << _item->_file << e.what(); + } + catch (...) + { + qCWarning(lcPropagateDownload()) << _item->_instruction << _item->_file; + } #else if (existingFile.permissions() != _tmpFile.permissions()) { _tmpFile.setPermissions(existingFile.permissions());